<template>
  <div>
    <h1 @click="get_data">点我获取后端数据</h1>
    <h1>{{ get_data_list }}</h1>
    <ul>
      <li v-for="(values,index) in student_list" :key="values.id">{{ values.name }}</li>
    </ul>
    <img src="static/image/dog.png" alt="图片">
  </div>
</template>

<script>
export default {
  name: "MyVue",
  data() {
    return {
      student_list: [],
      get_data_list: []
    }
  }, methods: {
    get_student_data() {
      this.$axios.get(`${this.$settings.host}/api/home`)
        // this.$axios.get(`${this.$settings.host}/t1/`)
        .then((res) => {
          // console.log(res.data)
          this.student_list = res.data.msg
        })
        .catch((error) => {

        })
    },
    get_data() {
      this.$axios.get(`${this.$settings.host}/t1/`)
        .then((res) => {
          // console.log(res.data)
          this.get_data_list = res.data
        })
        .catch((error) => {

        })
    },
  },
  created() {
    this.get_student_data();
  }
}
</script>

<style scoped>

</style>

